Ext.define('planner.store.Requeres', {
	extend: 'Ext.data.TreeStore',
	storeId: 'Requeres',
	model: 'planner.model.Requeres',
	autoLoad: true,
	autoSync: true,
	fields:[
		{ name: 'id', type: 'integer'},
		{ name: 'parent', type: 'integer'},
		{ name: 'date', type: 'integer'},
		{ name: 'source', type: 'string'},/*источник*/
		{ name: 'source_id', type: 'integer'},
		{ name: 'title', type: 'string'},
		{ name: 'body', type: 'string'},
		{ name: 'level', type: 'integer'},/*уровень вложенности*/
		{ name: 'state', type: 'string'},/*в каком состоянии сейчас требование*/
		{ name: 'state_id', type: 'integer'},
	],
    //groupField: 'id',
	/*proxy: {        
		type: 'ajax',
		root: 'jobs',        
		url : 'data/jobs/',        
		reader: {
			type: 'json', 
			root: 'data_container', 
			successProperty: 'success'
		},
		writer: {
			type: 'json', 
			root: 'data_container'
		},
		method: 'POST',
		api: {
		    create  : 'data/jobs/add/',
		    read    : 'data/jobs/select/',
		    update  : 'data/jobs/update/',
		    destroy : 'data/jobs/remove/'
		}
	},
	autoLoad: true,
	autoSync: true,
	*/
	/*data : [
		{id: 1, parent: -1, title: 'title 1', body: 'kuzb1', comments: [
			{id: 5, parent: 1, title: 'title 5', body: 'kuzb15'},
			{id: 6, parent: 1, title: 'title 6', body: 'kuzb16'},
		]},
		{id: 2, parent: -1, title: 'title 2', body: 'kuzb12', comments: []},
		{id: 3, parent: -1, title: 'title 3', body: 'kuzb13', comments: []},
		{id: 4, parent: -1, title: 'title 4', body: 'kuzb14', comments: []},

    ],*/
    root : {
    	expanded: true,
		children:[
			{id: 1, parent: -1, date: 1000000, source: 'asd', source_id: 1, state: 'new', title: 'title 1', body: 'kuzb1', level: 0, children: [
				{id: 5, parent: -1, date: 1000001, source: 'asd', source_id: 1, state: 'new', title: 'title 5', body: 'kuzb15', level: 1},
				{id: 6, parent: -1, date: 1000000, source: 'asd', source_id: 1, state: 'new', title: 'title 6', body: 'kuzb16', level: 1, children: [
					{id: 7, parent: -1, date: 1000003, source: 'asd', source_id: 1, state: 'new', title: 'title 7', body: 'kuzb175', level: 2},
					{id: 8, parent: -1, date: 1000000, source: 'asd', source_id: 1, state: 'new', title: 'title 8', body: 'kuzb186', level: 2},
				]},
			]},
			{id: 2, parent: -1, date: 1000002, source: 'asd', source_id: 1, state: 'new', title: 'title 2', body: 'kuzb12', level: 0},
			{id: 3, parent: -1, date: 1000000, source: 'asd', source_id: 1, state: 'new', title: 'title 3', body: 'kuzb13', level: 0, children: [
					{id: 9, parent: 3, date: 1000003, source: 'asd', source_id: 1, state: 'new', title: 'title 7', body: 'kuzb175', level: 1},
					{id: 10, parent: 3, date: 1000000, source: 'asd', source_id: 1, state: 'new', title: 'title 8', body: 'kuzb186', level: 1},
				]},
			{id: 4, parent: -1, date: 1000002, source: 'asd', source_id: 1, state: 'new', title: 'title 4', body: 'kuzb14', level: 0},
	    ]
	}
});
 
